package com.itheima.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//声明配置文件
@Configuration
public class MPConfig {

    /*声明为一个bean*/
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        /*配置拦截器*/
        MybatisPlusInterceptor interceptor=new MybatisPlusInterceptor();
        /*调用拦截器内置类*/
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        /*返回一个对象即可*/
        return interceptor;
    }
}
